<template>
  <div class="setting-container">
    <div class="app-container">
      <el-card>
        <el-tabs>
          <!-- 左侧 -->
          <el-tab-pane label="角色管理">
            <!-- 按钮 -->
            <el-button icon="el-icon-plus" size="small" type="primary">
              新增角色
            </el-button>
            <!-- 表格 -->
            <!--el table 帮我们在内部写好了v-for 来遍历数据了   -->
            <el-table :data="list" style="width: 100%">
              <el-table-column label="序号" width="100" />
              <el-table-column label="角色名称" width="240" />
              <el-table-column label="描述" />
              <el-table-column label="操作">
                <el-button size="small" type="success">分配权限</el-button>
                <el-button size="small" type="primary">编辑</el-button>
                <el-button size="small" type="danger">删除</el-button>
              </el-table-column>
            </el-table>
          </el-tab-pane>

          <el-tab-pane label="公司信息">
            <!-- 公司信息 -->
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>
<script>
import { getRoleListApi } from '@/api/setting'
export default {
  name: 'Setting',
  data() {
    return {
      list: [],
      page: 1, // 当前页
      pagesize: 10, // 每页条数
      total: 0 // 总条数
    }
  },
  created() {
    this.getRoleList() // 获取角色列表
  },
  methods: {
    async getRoleList() {
      const { data } = await getRoleListApi(this.page, this.pagesize)
      const { total, rows } = data
      this.total = total
      this.list = rows
    }
  }
}
</script>
